package com.design.command;

/**
 * @author leali
 * @title: FunctionButton
 * @projectName design
 * @description: 功能键类：请求发送者
 * @date 2022/1/3 16:52
 */
public class FunctionButton {
    /**
     * 功能键名称
     */
    private final String name;
    /**
     * 维持一个抽象命令对象的引用
     */
    private Command command;

    public FunctionButton(String name) {
        this.name = name;
    }

    public String getName() {
        return this.name;
    }

    public void setCommand(Command command) {
        this.command = command;
    }

    public void onClick() {
        System.out.print("点击功能键：");
        command.execute();
    }
}
